package com.openbravo.pos.sql;

import com.openbravo.basic.BasicException;
import com.openbravo.data.gui.JMessageDialog;
import com.openbravo.data.gui.MessageInf;
import com.openbravo.data.loader.Session;
import com.openbravo.pos.forms.AppConfig;
import com.openbravo.pos.forms.AppProperties;
import com.openbravo.pos.forms.AppUserView;
import com.openbravo.pos.forms.AppView;
import com.openbravo.pos.forms.AppViewConnection;
import com.openbravo.pos.forms.BeanFactoryException;
import com.openbravo.pos.printer.DeviceTicket;
import com.openbravo.pos.scale.DeviceScale;
import com.openbravo.pos.scanpal2.DeviceScanner;
import java.awt.Container;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Toolkit;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.Date;
import javax.swing.JFrame;

public class JFrmSQL extends JFrame
  implements AppView
{
  private AppProperties m_props;
  private Session session;
  private JPanelSQL sql;

  private boolean start(AppProperties paramAppProperties)
  {
    this.m_props = paramAppProperties;
    initComponents();
    try
    {
      this.session = AppViewConnection.createSession(paramAppProperties);
    }
    catch (BasicException localBasicException1)
    {
      JMessageDialog.showMessage(this, new MessageInf(-16777216, localBasicException1.getMessage(), localBasicException1));
      return false;
    }
    addWindowListener(new MyFrameListener( ));
    this.sql = new JPanelSQL(this);
    getContentPane().add(this.sql, "Center");
    try
    {
      this.sql.activate();
    }
    catch (BasicException localBasicException2)
    {
    }
    setVisible(true);
    return true;
  }

  public DeviceScale getDeviceScale()
  {
    return null;
  }

  public DeviceScanner getDeviceScanner()
  {
    return null;
  }

  public DeviceTicket getDeviceTicket()
  {
    return null;
  }

  public String getActiveCashIndex()
  {
    return null;
  }

  public Date getActiveCashDateStart()
  {
    return null;
  }

  public int getActiveCashSequence()
  {
    return 0;
  }

  public Date getActiveCashDateEnd()
  {
    return null;
  }

  public String getInventoryLocation()
  {
    return null;
  }

  public void setActiveCash(String paramString, int paramInt, Date paramDate1, Date paramDate2)
  {
  }

  public Session getSession()
  {
    return this.session;
  }

  public AppProperties getProperties()
  {
    return this.m_props;
  }

  public Object getBean(String paramString)
    throws BeanFactoryException
  {
    return null;
  }

  public JFrame getFrame()
  {
    return this;
  }

  public void waitCursorBegin()
  {
    setCursor(Cursor.getPredefinedCursor(3));
  }

  public void waitCursorEnd()
  {
    setCursor(Cursor.getPredefinedCursor(0));
  }

  public AppUserView getAppUserView()
  {
    return null;
  }

  private void initComponents()
  {
    setDefaultCloseOperation(0);
    Dimension localDimension = Toolkit.getDefaultToolkit().getScreenSize();
    setBounds((localDimension.width - 706) / 2, (localDimension.height - 369) / 2, 706, 369);
  }

  public static void main(final String[] paramArrayOfString)
  {
    EventQueue.invokeLater(new Runnable( )
    {
      public void run()
      {
        AppConfig localAppConfig = new AppConfig(paramArrayOfString);
        localAppConfig.load();
        if (!new JFrmSQL().start(localAppConfig))
          System.exit(1);
      }
    });
  }

  private class MyFrameListener extends WindowAdapter
  {
    private MyFrameListener()
    {
    }

    public void windowClosing(WindowEvent paramWindowEvent)
    {
      JFrmSQL.this.sql.deactivate();
      JFrmSQL.this.session.close();
      JFrmSQL.this.dispose();
    }

    public void windowClosed(WindowEvent paramWindowEvent)
    {
      System.exit(0);
    }
  }
}

/* Location:           D:\PowerFulPOS-2.30.2\openbravopos.jar
 * Qualified Name:     com.openbravo.pos.sql.JFrmSQL
 * JD-Core Version:    0.6.0
 */